<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/common.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <link href="${pageContext.request.contextPath}/resource/css/def/ztree/metro.css" rel="stylesheet">
  	<link href="${pageContext.request.contextPath}/resource/css/def/bootstrap/ace/ace-part2.min.css" rel="stylesheet">
  	<link href="${pageContext.request.contextPath}/resource/css/def/bootstrap/ace/ace.css" rel="stylesheet">
  	<link href="${pageContext.request.contextPath}/resource/css/def/frm/common/common.css" rel="stylesheet">
  	<script src="${pageContext.request.contextPath}/resource/js/jquery/plugin/handlebars-v3.0.1.js"></script>
  	<script src="${pageContext.request.contextPath}/resource/js/bootstrap/validator/bootstrapValidator.js"></script>
  	<!-- 新增 -->
  	 <link href="${pageContext.request.contextPath}/resource/css/index.css" rel="stylesheet">
  	 <script src="${prcs}/js/jquery/plugin/My97DatePicker/WdatePicker.js"></script>
     <script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jquery/plugin/jquery.ztree.all-3.5.min.js"></script>
     <script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/frm/sys/disOrgTree.js"></script>
  </head>
<script type="text/javascript">

$(function () {
	var applyStr = '${applyInfo}';
	var applyInfo = JSON.parse(applyStr);
	var taskKey = "${taskDefinitionKey}";
	//alert(taskKey);
	var viewType = "${viewType}";
	//alert(viewType);
	//判断taskDefinitionKey是否为usertask3，如果是，更改前台按钮显示，通过--》提交 退回--》隐藏掉
	if(taskKey == "usertask4"){
		$("#passButton").text("提交");
		$("#backButton").hide();
	}
	if(taskKey == "usertask4"){
		$("#backButton").hide();
	}
	if(taskKey == "usertask5"){
		$("#backButton").hide();
	}
	//viewType状态是1：显示是否有纸质checkbox并且是选中是
	if(taskKey == "usertask5"){
		$("#sfzz").css('display','');
		if(viewType == "1"){
			$("#inlineRadio1").attr("checked","checked");
		}else{
			$("#inlineRadio2").attr("checked","checked");
		}
	}
	/*
	if(viewType == "1"){
		$("#sfzz").css('display','');
		//$("#inlineRadio1").checked;
		$("#inlineRadio1").attr("checked","checked");
	}else if(taskKey == "usertask5"){
		//状态是1：是usertask5,显示是否有纸质checkbox
		$("#sfzz").css('display','');
		$("#inlineRadio2").attr("checked","checked");
	}*/
	//selectInfo();
	initApplyInfo(applyInfo);
});

function  initApplyInfo(data){
	$("#elec_id").val(data.elec_id);
	$("#ajname").val(data.name);
	$("#prov").val(data.prov);
	$("#prov_name").val(data.prov_name);
	$("#eparchy_code").val(data.eparchy_code);
	$("#eparchy_code_name").val(data.eparchy_code_name);
	//$("#apply_staff_id").val(data.apply_staff_id);
	$("#org_id").val(data.org_id);
	$("#org_name").val(data.org_name);
	//$("#sel_staff_id").val(data.sel_staff_id);
	$("#valid_start_date").val(data.valid_start_date);
	$("#valid_end_date").val(data.valid_end_date);
	$("#apply_desc").val(data.apply_desc);
	$("#apply_date").val(data.apply_date);
	$('#num').text(data.num); 
	$('#apply_staff_name').text(data.applyName);
	$('#apply_staff_id').val(data.applyId);
	var doArr = data.doStaffInfo;
    var doHtml = ""; 
	$.each(doArr, function (n, value) {  
		doHtml += "<a href='javascript:void(0)' style='color:#337ab7;' onclick='toBanAnXx("+value.staffId+")' >"+value.name+"</a>";
		if (n < doArr.length - 1){
			doHtml += ",";
        }
    });  
	$("#sel_staff_id").html(doHtml);
}
function selectInfo(){
	$.ajax({
			url:prc + "/dzghApplyController/selectInfo.action",
			data:{
				proc_inst_id:${processInstanceId}
			},
			dataType:"JSON",
			type:"POST",
			success:function(data){
				$("#elec_id").val(data.elec_id);
				$("#ajname").val(data.name);
				$("#prov").val(data.prov);
				$("#prov_name").val(data.prov_name);
				$("#eparchy_code").val(data.eparchy_code);
				$("#eparchy_code_name").val(data.eparchy_code_name);
				//$("#apply_staff_id").val(data.apply_staff_id);
				$("#org_id").val(data.org_id);
				$("#org_name").val(data.org_name);
				//$("#sel_staff_id").val(data.sel_staff_id);
				$("#valid_start_date").val(data.valid_start_date);
				$("#valid_end_date").val(data.valid_end_date);
				$("#apply_desc").val(data.apply_desc);
				$("#apply_date").val(data.apply_date);
				var num = data.num;
				$('#num').text(num); 
				$('#apply_staff_name').text(data.applyName);
				$('#apply_staff_id').val(data.applyId);
				$("#sel_staff_id").html(data.sumName);
			},
			error:function(e){
				alertModel("查询电子公函失败o_o请查明原因后重试！");
			}
		})
}
//关闭当前页面
function closeAddPage(){
	window.close();
} 
//核验号码信息
function doDetail() {
	var elec_id = $("#elec_id").val();
	var url = prc + "/hyNumController/goDatas?selectType=1&elec_id="+elec_id;
	var iframe = $("#_url").attr("src", url);
	iframe.load(function() { 
		try{
            var bHeight = iframe.contentWindow.document.body.scrollHeight;
            var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
            var height = Math.max(bHeight, dHeight);
            iframe.height =  Math.max(height,400);
	    }catch (ex){}
			
		$('#numModal').modal({
			'show' : true
		});
	}); 
	
	
}
//跳转到警员信息页面
function toJyXx(obj) {
	var staffId = $("#apply_staff_id").val();
	var url = prc + "/jyxxController/jyxxInfo?staffId="+staffId;
	var iframe = $("#jump_url").attr("src", url);
	iframe.load(function() { 
		$('#infoModal').modal({
			'show' : true
		});
	}); 
}

//跳转到办案人员信息页面
function toBanAnXx(obj) {
	//var staffId = $("#sel_staff_id").text();
	var url = prc + "/jyxxController/jyxxInfo?staffId="+obj;
	var iframe = $("#jump_url").attr("src", url);
	iframe.load(function() { 
		$('#infoModal').modal({
			'show' : true
		});
	}); 
}
</script>
  <body onload="selectInfo()">
			<div style="height:100%;" class="main-content">
				<div class="page-content" style="background: #fff">
				<form class="form-horizontal" role="form" id="dzghForm" autocomplete="off">
					<div class="head-title"><span>电子公函详情</span></div>
					<div class="check-div">
						<div class="row check-row apply-row">
							<div class="col-sm-12">
								<div class="input-group">
									<span class="input-group-addon">电子公函编号 </span>
									<input type="text" id="elec_id" name="elec_id" class="form-control"
										   disabled="disabled">
								</div>
							</div>
						</div>
						<div class="row check-row apply-row">
							<div class="col-sm-12">
								<div class="input-group">
									<span class="input-group-addon">案件名称 </span>
									<input id="ajname" type="text" class="form-control" name="ajname" disabled="disabled">
								</div>
							</div>
						</div>
						<div class="row check-row apply-row">
							<div class="col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">申请省份</span>
									<input id="prov_name" type="text" class="form-control" name="prov_name" 
										   disabled="disabled">
									<input  id="prov" type="hidden" class="form-control" name="prov">
								</div>
							</div>
							<div class="col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">申请地市</span>
									<input id="eparchy_code_name"  type="text" class="form-control" name="eparchy_code_name" 
										   disabled="disabled">
									<input  id="eparchy_code" type="hidden" class="form-control" name="eparchy_code">
								</div>
							</div>
						</div>
						<div class="row check-row apply-row">
						<div class="col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">申请单位</span>
									<input  id="org_name" type="text" class="form-control"  name="org_name" disabled="disabled">
									<input  id="org_id" type="hidden" class="form-control" name="org_id">
								</div>
						</div>
						<div class="col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">申请时间</span>
									<input  id="apply_date" type="text" class="form-control" name="apply_date" disabled="disabled">
								</div>
						</div>
						</div>
						<div class="row check-row apply-row">
							<div class="col-sm-12">
								<div class="input-group">
									<span class="input-group-addon">申请人员</span>
									<div class="form-control">
										<a id="apply_staff_name" name="apply_staff_name"  onClick="toJyXx()" style="color:#337ab7;"></a>
										<input  id="apply_staff_id" type="hidden" class="form-control" name="apply_staff_id">
									</div>
								</div>
							</div>
						</div>
						<div class="row check-row apply-row">
						
							<div class="col-sm-12">
								<div class="input-group">
									<span class="input-group-addon">办案人员</span>
									<div class="form-control">
										<!-- <a id="sel_staff_id" name="sel_staff_id"  onClick="toBanAnXx()" style="color:blue;text-decoration:underline"></a> -->
										<!-- <input  id="sel_staff_id" type="text" class="form-control" name="sel_staff_id" disabled="disabled"> -->
										<div id="sel_staff_id"></div>
									</div>
								</div>
							</div>
						</div>
						<div class="row check-row apply-row">
							<div class="col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">检验时效</span>
									<input id="valid_start_date" type="text" class="form-control" name="valid_start_date" id="valid_start_date" disabled="disabled">
								</div>
							</div>
							<div class="col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">至</span>
									<input id="valid_end_date" type="text" class="form-control" name="valid_end_date" id="valid_end_date" disabled="disabled">
								</div>
							</div>
						</div>
						<div class="row apply-row" style="height: 52px;">
							<div class="col-sm-12">
								<div class="input-group">
									<span class="input-group-addon">申请描述</span>
									<textarea id="apply_desc" type="text" class="form-control" name="apply_desc" disabled="disabled"></textarea>
								</div>
							</div>
						</div>
						<div class="row apply-row">
							<div class="col-sm-12">
								<div class="input-group">
									<span class="input-group-addon">核验身份证数量</span>
									<div class="form-control">
										<a id="num" name="num"  onClick="doDetail()" style="color:#337ab7;"></a>
									</div>
									
								</div>
							</div>
						</div>
						<div id="sfzz" class="row apply-row" style="display:none">
							<div class="col-sm-12">
								<div class="input-group">
									<span class="input-group-addon">是否收到纸质</span>
									<div class="form-control">
										<label class="radio-inline">
											<input type="radio" name="importType" id="inlineRadio1"  value="1"> 是
										</label>
										<label class="radio-inline">
											<input type="radio" name="importType" id="inlineRadio2"  value="0"> 否
										</label>
									</div>
									
								</div>
							</div>
						</div>
					</div>
            </form>
				</div>
			</div>
			
	<!-- 人员信息模态框 开始 -->
	<div class="modal fade" id="infoModal" tabindex="-1" role="dialog" aria-labelledby="infoModal_label" style="width:100%;height:90%;overflow:hidden;">
		<div class="modal-dialog" style="min-width: 800px;min-height:800px;overflow:hidden;">
			<div class="modal-content" style="overflow:hidden;">
	            <div class="modal-header">
	                <span type="button" class="close" data-dismiss="modal" aria-label="Close">
	                    <span aria-hidden="true">&times;</span>
	                </span>
	                <h4 class="modal-title" id="orgModalLabel">人员信息详情</h4>
	            </div>
				<div>
					<iframe id="jump_url" width="100%" height="300px" src="" style="min-height: 300px;overflow:auto;"></iframe>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>
	<!-- 人员信息模态框 结束 -->
	<!-- 核验号码模态框 开始 -->
	<div class="modal fade" id="numModal" tabindex="-1" role="dialog" aria-labelledby="infoModal_label" style="width:100%;height:80%;">
		<div class="modal-dialog" style="min-width: 800px;">
			<div class="modal-content" style="border:none;">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
	                    <span aria-hidden="true">&times;</span>
	                </button>
				<div style="border:none;">
					<iframe id="_url" width="100%"  src="" style="min-height: 270px;overflow:auto;border-top-width: 0px;"></iframe>
				</div>
				<div class="modal-footer" style="border:none;">
					<button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>
	<!-- 核验号码模态框 结束 -->
  </body>
</html>
